#include "test.hpp"
#include "mock_manager.hpp"
#include "example_view.hpp"
#include "example_presenter.hpp"
#include "mock_example_view.hpp"

namespace vimock {
struct example_presenter_test_fixture {
	mock_manager mm;
	example_view mock_view;
	example_presenter presenter;
	example_presenter_test_fixture() :
		mm(),
		mock_view(new mock_example_view(mm)),
		presenter(mock_view) {
	}
};

TEST_SUITE(example_presenter_test, example_presenter_test_fixture);

TEST_CASE(handle_closing_should_proceed_when_user_decide_should_continue_closing) {
	mm.expect(mock_view->should_continue_closing()).ret(true);
	mm.replay();
	
	bool cancel = true;
	presenter.handle_closing(cancel);
	assert_is_false(cancel);
	mm.verify();
}

TEST_CASE(handle_closing_should_cancel_when_user_decide_should_not_continue_closing) {
	mm.expect(mock_view->should_continue_closing()).ret(false);
	mm.replay();

	bool cancel = false;
	presenter.handle_closing(cancel);
	assert_is_true(cancel);
	mm.verify();
}

TEST_SUITE_END();
}
